package com.bd08.flink.demo.jing

import org.apache.flink.api.scala.ExecutionEnvironment
import org.apache.flink.streaming.api.scala.createTypeInformation

object ReduceGroup extends App {
  val benv = ExecutionEnvironment.getExecutionEnvironment
  val ds=benv.fromCollection(List("a","b","c","d","a","c"))

  ds.reduceGroup(elements=>elements.toList.toString()).print()


  ds.map((_,1)).groupBy(0).reduceGroup(elements=>
    elements.reduce((x,y)=>(x._1,x._2+y._2))).print()

}
